<?php

/**
 * This is the model class for table "account".
 *
 * The followings are the available columns in table 'account':
 * @property integer $id
 * @property integer $user_id
 * @property integer $country_id
 * @property string $email
 * @property string $email_pass
 * @property string $cl_pass
 * @property string $fw_email
 * @property string $fw_email_pass
 * @property string $phone
 * @property string $state
 * @property string $city
 * @property string $link
 * @property string $proxy
 * @property string $remarks
 * @property string $last_posted_date
 * @property string $working
 * @property string $proxy_ip
 * @property string $proxy_port
 * @property string $proxy_username
 * @property string $proxy_password
 */
class Account extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Account the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'account';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('country_id,user_id,working', 'numerical', 'integerOnly'=>true),
			array('proxy_ip,proxy_port,proxy_username,proxy_password,email, email_pass, cl_pass, fw_email, fw_email_pass, phone, state, city, link, proxy, remarks', 'length', 'max'=>255),
			array('last_posted_date', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id,user_id, country_id, email, email_pass, cl_pass, fw_email, fw_email_pass, phone, state, city, link, proxy, remarks, last_posted_date,working', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'user_id' => "User ID",
			'country_id' => 'Country',
			'email' => 'Email',
			'email_pass' => 'Email Pass',
			'cl_pass' => 'Cl Pass',
			'fw_email' => 'Fw Email',
			'fw_email_pass' => 'Fw Email Pass',
			'phone' => 'Phone',
			'state' => 'State',
			'city' => 'City',
			'link' => 'Link',
			'proxy' => 'Proxy',
			'remarks' => 'Remarks',
			'last_posted_date' => 'Last Posted Date',
                        'proxy_ip' => 'proxy ip',
                        'proxy_port' => 'proxy port',
                        'proxy_username' => 'proxy username',
                        'proxy_password' => 'proxy password',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('user_id',$this->user_id);
		$criteria->compare('country_id',$this->country_id);
		$criteria->compare('email',$this->email,true);
		$criteria->compare('email_pass',$this->email_pass,true);
		$criteria->compare('cl_pass',$this->cl_pass,true);
		$criteria->compare('fw_email',$this->fw_email,true);
		$criteria->compare('fw_email_pass',$this->fw_email_pass,true);
		$criteria->compare('phone',$this->phone,true);
		$criteria->compare('state',$this->state,true);
		$criteria->compare('city',$this->city,true);
		$criteria->compare('link',$this->link,true);
		$criteria->compare('proxy',$this->proxy,true);
		$criteria->compare('remarks',$this->remarks,true);
		$criteria->compare('last_posted_date',$this->last_posted_date,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}